package cn.demo.text.editor.strategy.menu;

import cn.demo.text.editor.constant.Str;

import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;

public class OpenMenuItem extends JMenuItem {

    public OpenMenuItem(ActionListener actionListener) {
        super(Str.OPEN, null);
        this.addActionListener(actionListener);
        this.setActionCommand(Str.OPEN);
        this.setFont(new MenuFont());
        this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK));
    }
}
